﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace XmlDSigEx
{
    class CryptoConfigDigestAlgorithm : IDigestAlgorithm
    {
        internal const string URI_DIGEST_SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1";
        internal const string URI_DIGEST_SHA256 = "http://www.w3.org/2001/04/xmlenc#sha256";
        internal const string URI_DIGEST_SHA512 = "http://www.w3.org/2001/04/xmlenc#sha512";

        private string _uri;

        internal CryptoConfigDigestAlgorithm(string uri)
        {
            _uri = uri;
        }

        #region IDigestAlgorithm Members

        public byte[] CreateDigest(System.IO.Stream input)
        {
            HashAlgorithm sha1 = HashAlgorithm.Create(_uri);
            return sha1.ComputeHash(input);
        }

        #endregion
    }
}
